<template>
  <button
    class="pt-4 text-blue-600"
    :class="[showCommentBox ? 'pb-2' : 'pb-10']"
    @click="showCommentBox = !showCommentBox"
  >
    回复
  </button>
  <CommentBox
    v-if="showCommentBox"
    @submit="
      emit('submit', $event);
      showCommentBox = false;
    "
    class="mb-4"
  />
</template>

<script setup>
import { ref } from "vue";
import CommentBox from "./CommentBox.vue";

const emit = defineEmits(["submit"]);

const showCommentBox = ref(false);
</script>

<style scoped></style>
